// navbar.js
// 获取应用实例
const app = getApp();
Component({
  properties: {

    closeShow:{
      type: Boolean,
      value: true,
      observer: function (e) {}
    },

    show: {
      type: Boolean,
      value: false,
      observer: function (e) {

        if(e){
          this.setData({  
            blockShow:e
          })
        }
        wx.nextTick(()=>{
          const rate =e?-1:1;
          this.data.animation.translateY(rate*(app.globalData.windowHeight + app.globalData.CustomBar + app.globalData.StatusBar) +100).step()
              setTimeout(()=>{
                this.setData({  
                  passBlockAnimate: this.data.animation.export()   //输出动画  
                }) 
                
                if(!e){
                  this.setData({  
                    blockShow:e
                  })
                }
          },0)
        });

       
       }
    },
   
  },
  data:{
    animation:"",
    passBlockAnimate:"",
    blockShow:false
  },
  
  lifetimes: {
    created(){
      this.setData({
        animation:wx.createAnimation({
          duration: 500,  // 动画持续时间为1秒
          timingFunction: 'ease-out'  // 动画效果为缓动效果
        })
      });

    },

    attached: function () {
      
     }
  },
  pageLifetimes: {
    /**
     * 生命周期函数--监听页面加载
     */
    show: function (options) {

     

    },
    created: function () {
      
    },
    attached: function () {

    },
    ready: function () {
    },
    moved: function () {

    },
    detached: function () {

    },
  },
  methods: {
    closeMask(){
      this.setData({
        show:false
      })
    },
  }   
})
